<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>JQuery Tabs</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <script src="../../../libs/jquery/3.2.1/jquery.js"></script>
    <script src="../../../libs/EventEmitter/5.2.4/EventEmitter.js"></script>
    <script src="main.js"></script>
    <link href="style.css" rel="stylesheet">
</head>

<body>
    <div id='tab-demo'>
        <div class='tabs-bar' role='tablist'>
            <ul class='tabs-nav'>
                <li role='tab' class='tabs-tab'>Tab 1</li>
                <li role='tab' class='tabs-tab'>Tab 2</li>
                <li role='tab' class='tabs-tab'>Tab 3</li>
            </ul>
        </div>
        <div class='tabs-content'>
            <div role='tabpanel' class="tabs-panel">
                第1个Tab里的内容
            </div>
            <div role='tabpanel' class="tabs-panel">
                第2个Tab里的内容
            </div>
            <div role='tabpanel' class="tabs-panel">
                第3个Tab里的内容
            </div>
        </div>
    </div>
</body>
<script>
    //*
    const tab = new Tabs({
        element: '#tab-demo',
        tabs: '#tab-demo .tabs-nav li',
        panels: '#tab-demo .tabs-content div',
        activeIndex: 1,
    });
    tab.events.on('change', (o) => {
        console.log(o);
    });
    //*/
</script>

</html>